package com.chen.apidriver.controller;

import com.chen.apidriver.service.UserService;
import com.chen.internalcommon.dto.DriverUser;
import com.chen.internalcommon.dto.DriverUserWorkStatus;
import com.chen.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author chenLiuPing
 **/
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 修改司机信息
     * @param driverUser
     * @return
     */
    @PutMapping("/user")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser) {
        return userService.updateDriverUser(driverUser);
    }

    /**
     * 修改司机工作状态接口
     * @return
     */
    @PostMapping("/driver-user-work-status")
    public ResponseResult changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus) {
        Long driverId = driverUserWorkStatus.getDriverId();
        Integer workStatus = driverUserWorkStatus.getWorkStatus();
        return userService.changeWorkStatus(driverId, workStatus);
    }
}
